<!-- BEGIN PAGE HEADER-->
<?php $this->load->view('partials/breadcrumb.tpl',  Array('_NO_IOSS_NEW'=>'1'))?>
<!-- END PAGE HEADER-->
<!-- BEGIN PAGE CONTENT-->
<script type="text/javascript">
function defConfirm(url){
	if(!confirm("确定要删除吗？")){
		return false;
	}
	window.location.href = url;
	return true;
}
$(document).ready(function(){
	$("#reset").click(function(){
		$("select").val('');
		$("input[type='text']").val('');
	});
	$('#selectAllButton').click(function(){
		$("input:checkbox").parent().attr("class","checked");
	});
	$('#deSelectAllButton').click(function(){
		$("input:checkbox").parent().attr("class",""); 
	});
	$('#submitButton').click(function(){
		if($("input:checkbox").parent('span.checked').length == 0){
			alert('请至少选择一个用户进行设定！');
			return;
		}
		if(!$.trim($('#set_bank_code').val())){
			alert('请先设定自有通道编号');
			$('#set_bank_code').focus();
			return;
		}
		var chk_value = [];
		$("input:checkbox").parent('span.checked').each(function(){
			var chbox = $(this).children()[0];
			chk_value.push($(chbox).val());
		});

		$('#formBankCode').val($.trim($('#set_bank_code').val()));
		$('#formUserIds').val(chk_value);
		$('#resetCodeForm').submit();
			
	});
	
});

</script>
<div class="row">
	<div class="col-md-12">
		<!-- Begin: life time stats -->
		<div class="portlet">

			<?=form_open('', Array('class'=>'form-inline', 'role'=>'form'))?>
				<?=search_form_input('id',filterValue('id'),'用户编号', 'class="form-control input-medium"');?>
				<?=search_form_input('account',filterValue('account'),'用户账号', 'class="form-control input-medium"');?>
				<?=search_form_input('set_bank_code',filterValue('set_bank_code'),'通道编号', 'class="form-control input-medium"');?>
				<?=search_form_dropdown('status',Array(''=>'选择状态...', '1'=>'普通用户', '0'=>'禁用'),filterValue('status'),'状态', 'class="form-control input-medium"');?>
				<button type="button" class="btn default" id="reset">重置条件</button>
				<button type="submit" class="btn green about_search">搜索 <i class="fa fa-search"></i></button>
			<?=form_close()?>

			<div class="portlet-body">
				<div class="row">
					<div class="col-md-12">
						<div class="table-scrollable">
							<table class="table table-hover table-bordered table-striped">
								<thead>
								<tr>
									<th>用户编号</th>				
									<th>用户账号</th>
									<th>设定自有通道编号</th>
									<th>
    									<input type="button" value="全选" id="selectAllButton"/>
    									<input type="button" value="取消全选" id="deSelectAllButton"/>
    									<input type="text" value="" placeholder="重新设定自有通道编号" class="input-small" id="set_bank_code"/>
    									<input type="button" value="提交修改" id="submitButton"/>
									</th>
								</tr>
								</thead>
								<tbody>
								<?php  foreach ($list as $item){	?>
									<tr>
										<td><?=$item->id?></td>
										<td><?=htmlspecialchars($item->account)?></td>
										<td><?=$item->code?></td>
										<td><input type="checkbox" name="id[]" value="<?=$item->id?>"/></td>
									</tr>
								<?php }?>
								<form action="<?=site_url($thisModule.$thisController.'/postresetcode')?>" method="post" id="resetCodeForm">
									<input type="hidden" name="setBankCode" id="formBankCode"/>
									<input type="hidden" name="ids" id="formUserIds"/>
								</form>
								</tbody>
							</table>
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-md-12 text-right">
						<?=$pagination?>
					</div>
				</div>
			</div>
		</div>
		<!-- End: life time stats -->
	</div>
</div>

<!-- END PAGE CONTENT-->
